package cn.bgs.service.impl;

import cn.bgs.dao.DormitoryMapper;
import cn.bgs.pojo.Dormitory;
import cn.bgs.service.DormitoryService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DormitoryServiceImpl implements DormitoryService {
    @Autowired private DormitoryMapper dormitoryMapper;


    @Override
    public PageInfo<Dormitory> findAll(Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);

        List<Dormitory> list=dormitoryMapper.findAll();
        PageInfo<Dormitory> FF= new PageInfo<>(list);
        return FF;


    }

    @Override
    public void deleteDor(Integer pkId) {
        dormitoryMapper.deleteDor(pkId);
    }

    @Override
    public Dormitory selectByPrimaryKey(Integer pkId) {
        return dormitoryMapper.selectByPrimaryKey(pkId);
    }

    @Override
    public int updateByPrimaryKeySelective(Dormitory record) {
        return dormitoryMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public PageInfo<Dormitory> queryDor(Integer pageNum, Integer pageSize, Dormitory dormitory) {
        PageHelper.startPage(pageNum,pageSize);

        List<Dormitory> list=dormitoryMapper.queryDor(dormitory);
        PageInfo<Dormitory> FF= new PageInfo<>(list);
        return FF;
    }


}
